package com.example.demo_01.controller;

import com.example.demo_01.service.TeaService;
import com.example.demo_01.util.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/TeaController")
public class TeaController {
    @Autowired
    private TeaService teaService;

    @RequestMapping("/findByParam")
    public ResultBean findByParam(@RequestParam Map<String, String> param) {
        return teaService.findByParam(param);
    }

    @RequestMapping("/save")
    public ResultBean save(@RequestParam Map<String, String> param) {
        return teaService.doSave(param);
    }

    @RequestMapping("/update")
    public ResultBean update(@RequestParam Map<String, String> param) {
        System.out.println(param);
        return teaService.doUpdate(param);
    }

    @RequestMapping("/delete")
    public ResultBean delete(@RequestParam String ids) {
        return teaService.delete(ids);
    }

    @RequestMapping("/analysis")
    public ResultBean analysis() {
        return teaService.getAnalysisData();
    }

    @RequestMapping("/ageSalaryAnalysis")
    public ResultBean getAgeSalaryDistribution() {
        return teaService.getAgeSalaryDistribution();
    }

}
